//
//  UIView+FFAnimation.m
//  PlayVideo
//
//  Created by NoNoKing on 2016/12/26.
//  Copyright © 2016年 yyx. All rights reserved.
//

#import "UIView+FFAnimation.h"

@implementation UIView (FFAnimation)

- (void)ff_shake
{
    CAKeyframeAnimation * keyAnimaion = [CAKeyframeAnimation animation];
    keyAnimaion.keyPath = @"transform.rotation";
    keyAnimaion.values = @[@(-3 / 180.0 * M_PI),@(3 /180.0 * M_PI),@(-3/ 180.0 * M_PI)];//度数转弧度
    
    keyAnimaion.removedOnCompletion = NO;
    keyAnimaion.fillMode = kCAFillModeForwards;
    keyAnimaion.duration = 0.25;
    keyAnimaion.repeatCount = MAXFLOAT;
    [self.layer addAnimation:keyAnimaion forKey:nil];
}

- (void)ff_stopAnimation
{
    [self.layer removeAllAnimations];
}

@end
